Post

Replies

Boosts

Views

Activity

Reply to DocC doesn't handled named subscript parameters correctly
It looks like this was a user error on my apart, abetted by an apparent bug in symbol-reference autocompletion. I had completely forgotten that the parameter naming rules for subscripts are different than for functions: subscript parameters don't take a label in the call unless you explicitly specify both a label and a local name in the declaration. So the type of the subscript declared public subscript(_ date: String, visit: CaseID) -> ValueOrMessage<Meeting> { ... } really is subscript(_:_:). not subscript(_:visit:). That explains why explicitly using the (::) worked. But it doesn't explain why the editor autocompletion wanted to give me (_:visit:). Anyway, changing the code declaration to public subscript(_ date: String, visit visit: CaseID) -> ValueOrMessage<Meeting> { ... } made the subscript work the way I expected, and made autocompletion work, too. BUT ... Roughly the same problem shows up with operator functions, and in this case, it looks like it may really be a DocC bug. Consider         public static func ==(_ lhs: Meeting.Item, _ rhs: Meeting.Item) -> Bool {...}         public static func <(_ lhs: Meeting.Item, _ rhs: Meeting.Item) -> Bool {...} and, in the documentation extension file, - ``<(_:_:)`` - ``==(_:_:)`` The equality declaration reference works as expected, and the apparently identical less-than declaration fails. In the Swift source, I get the diagnostic “Topic reference '%3C(%3A%3A)' couldn't be resolved. No local documentation matches this reference.” and in the documentation page the equality function shows up in my Ordering section, but the less-than function shows up in the auto-created Operators section.
Oct ’22
Reply to Unable to set initial selection state of SwiftUI `List` in iOS 14
No solution here. As far as I can tell, when SwiftUI instantiates or updates a List, it sets the bound selection variable to nil, and I have not been able to find any way to change this. For example, setting the selection variable in an .onAppear modifier on the list doesn't work, because SwiftUI apparently clears the selection after the onAppear action executes. I tried playing with the selection variable’s didSet property observer, but SwiftUI apparently clears the variable in a way that doesn’t trigger didSet. I’ve pretty much reached a dead end, too.
Nov ’21
Reply to Catching throw from initializer
What do you think attractive? What do you think better? What is the reason you think it is not attractive? (1) Having to separate the declaration and the initialization of a let constant is sometimes necessary, but always feels like a hack. One of the big advantages of guard is that I can initialize a let constant with an optional binding, without having to wrap the entire body of a function in an if statement. (2) A guard statement says immediately, “if his doesn't work, I’m out of here.” The do/catch requires a second look to determine that it’s really moral equivalent of a guard.
Jul ’20